﻿@Model
@{
    ViewBag.user = ViewContext.Controller.ControllerContext.HttpContext.Session["user"];
    ViewBag.role = ViewContext.Controller.ControllerContext.HttpContext.Session["role"];
    if (ViewBag.user != null)
    {
        ViewBag.UserName = ViewBag.user.ToString();
        if (ViewBag.role == "Admin")
        {
            ViewBag.isAdmin = true;
        }
        if (ViewBag.role == "Teacher")
        {
            ViewBag.isTeacher = true;
        }
         if (ViewBag.role == "Student")
        {
            ViewBag.isStudent = true;
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/bootstrap-huan.css")
    @Styles.Render("~/Content/style.css")
    
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/Scripts/bootstrap.js")
</head>
<body>
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="navbar-header" data-toggle="collapse" data-target="#naviagtionMenu">
            <a class="navbar-brand">考试管理系统</a>
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse" id="naviagtionMenu">
            @if (ViewBag.isAdmin != null){
                    <ul class="nav navbar-nav ">
                    <li class="active">
                        @Html.ActionLink("主页", "Index", "Home")
                    </li>
                    <li>
                        @Html.ActionLink("用户管理", "Index", "User")
                    </li>
                    <li>
                        @Html.ActionLink("用户组管理", "Index", "UserGroup")
                    </li>
                    <li>
                        @Html.ActionLink("试题管理", "Index", "Question")
                    </li>
                    <li>
                        @Html.ActionLink("考试管理", "Index", "Exam")
                    </li>
                    <li>
                        @Html.ActionLink("考试结果管理", "Index", "ExamResult")
                    </li>
                    <li>
                        @Html.ActionLink("个人设置", "Setting", "Student")
                    </li>
                </ul>
            }
            @if (ViewBag.isTeacher != null){
                    <ul class="nav navbar-nav ">
                    <li class="active">
                            @Html.ActionLink("主页", "Index", "Home")
                    </li>
                    <li>
                        @Html.ActionLink("试题管理", "Index", "Question")
                    </li>
                    <li>
                        @Html.ActionLink("考试管理", "Index", "Exam")
                    </li>
                    <li>
                        @Html.ActionLink("考试结果管理", "Index", "ExamResult")
                    </li>
                    <li>
                        @Html.ActionLink("个人设置", "Setting", "Student")
                    </li>
                </ul>
            }
            @if  (ViewBag.isStudent != null){ 
                <ul class="nav navbar-nav ">
                    <li class="active">
                        @Html.ActionLink("主页", "Index", "Home")
                    </li>
                    <li>
                        @Html.ActionLink("在线考试", "StartExam", "Home")
                    </li>
                    <li>
                        @Html.ActionLink("会员中心", "UserCenter", "Student")
                    </li>
                    <li>
                        @Html.ActionLink("个人设置", "Setting", "Student")
                    </li>
                </ul>
            }
            <ul class="nav navbar-nav navbar-right">
                @if (ViewBag.user != null)
                {
                    <li>
                        <a href="#" id="system-info-account" target="_blank">@ViewBag.UserName</a>
                    </li>

                    <li>
                        @Html.ActionLink("退出", "Logout", "Account")
                    </li>
                    
                }
                else
                {
                     <li>
                        @Html.ActionLink("登陆", "Login", "Account")
                    </li>
                    <li>
                        @Html.ActionLink("注册", "Create", "User")
                    </li>     
                }
            </ul>
        </div>
    </nav>
    <div class="container" style="padding-top:72px; min-height:600px">
        @RenderBody()
    </div>
    @Html.Partial("_FooterPartial")<!--_FooterPartial视图占位符-->
    @RenderSection("scripts", required: false)
</body>
</html>
